{% extends "templates/base.phtml" %}
{%block content%}
{% if wxc is defined %}
<!-- PAGE CONTENT WRAPPER -->
<div class="page-content-wrap">
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default tabs">
                <ul class="nav nav-tabs" role="tablist">
                    <!--  <li ><a href="admin/appact/newact">创建活动</a></li>-->
                     <li class="active"><a href="admin/appact/">报名活动</a></li>
                 <!--    <li><a href="admin/appact/detail">报名管理</a></li>-->
                </ul>
                <div class="panel-body tab-content">
                    <div class="tab-pane active">
                        <div class="col-md-12">
                            <div class="col-md-12 col-xs-6 pull-left">
                                <h3>当前活动</h3>

                                 <div class="form-group">
                                     <label class="col-md-1 col-xs-5 control-label">活动预览：</label>
                                     <div class="col-md-6 col-xs-5 ">
                                         <input type="text" class="form-control " value="{{actListUrl}}" >
                                     </div>
                                     <a class="btn btn-success" href="{{actListUrl}}">预览</a>
                                     <a class="btn btn-success pull-right" href="/admin/appact/newact">+新建活动</a>
                                 </div>
                            </div>



                            <div class="form-horizontal">
                                <div class="panel panel-default panel-content">
                                    <div class="panel-body def-pan-bd">
                                        <div class="col-bd col-md-12 col-xs-12">
                                            <div class="col-md-12 form-horizontal">

                                                <div class="panel-body">
                                                    <div class="row">
                                                        {% for actsArr in page.items %}
                                                        <div class="form-horizontal col-md-12 app-wrap">
                                                            <div class="col-md-2 col-sm-2 app-img">
                                                                <img src="{{actsArr['pic']}}"/>
                                                            </div>
                                                            <div class="col-md-8 col-sm-8 app-detail-wrap">
                                                                <div class="col-md-12 app-name">
                                                                    <h5>活动名称：{{actsArr['name']}}</h5>
                                                                </div>
                                                                <div class="col-md-12 app-detail">
                                                                    <h5>活动地点：{{actsArr['place']}}</h5>
                                                                </div>
                                                                <div class="col-md-12 app-version">
                                                                    <h5>活动时间：{{actsArr['time']}}</h5>
                                                                </div>
                                                                <div class="col-md-12 app-time">
                                                                    <h5>报名人数：{{actsArr['count']}}人报名</h5>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-2 col-sm-2 buy-wrap">

                                                                <div class="detail col-md-12"><a class="btn btn-info" href="/admin/appact/detail/{{actsArr['aid']}}">详情</a></div>
                                                            </div>
                                                            <div class="col-md-2 col-sm-2 buy-wrap">

                                                                <div class="detail col-md-12"><a class="btn btn-info" href="/frontend/act/detail?id={{actsArr['aid']}}&token={{actsArr['token']}}">预览</a></div>
                                                            </div>
                                                            <div class="col-md-2 col-sm-2 buy-wrap">
                                                               <div class="detail col-md-12"> <button class=" btn btn-danger" onclick="deleteConfirm({{ actsArr['aid'] }});">删除</button></div>
                                                            </div>

                                                        </div>
                                                        <hr/>
                                                        {% endfor %}
                                                    </div>
                                                    {% include 'include/page' with ['page':page,'cla':'pagination pagination-sm pull-right','url':'/admin/appact/index?page='] %}
                                                </div>


                                               <!-- <div class="form-group col-md-12">
                                                    <div class="col-md-6 col-xs-12 col-md-offset-4">
                                                        <button class="btn btn-primary J-save">保存</button>
                                                        <button class="btn btn-danger">取消</button>
                                                    </div>
                                                </div>-->
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{%endif%}
<!-- END PAGE CONTENT WRAPPER -->
{%endblock%}
{%block end%}
<style type="text/css">
    .control-label{
        position: relative;
        top:6px;
        left: 35px;
        width: 90px;
    }
    .panel-content{
        margin-top: 15px;
    }
    .app-wrap{
        padding: 5px 0px;
        border-bottom: 1px solid #E5E5E5;
    }
    .app-img{
        overflow: hidden;
        max-height: 150px;
    }
    .app-img img{
        width: 80%;
        height: auto;
    }
    .app-detail-wrap{
        margin-top: 5px;
    }
    .buy-wrap{
        padding-top: 1.5em;
    }
    .price *{
        color:#3FBAE4;
    }
    .detail{
        text-align:center;
    }
    .delete{
        padding-left: 20em;
    }
</style>
<script type="text/javascript">
    function deleteConfirm(delete_id){
        noty({
            text: '确定要删除此活动么?',
            layout: 'topRight',
            buttons: [
                {addClass: 'btn btn-success btn-clean', text: '确定', onClick: function($noty) {
                    $noty.close();
                    $.post('/admin/appact/delete/'+delete_id,{},function(result){


                        noty({text: '删除成功', layout: 'topRight', type: 'success'}
                        );setTimeout(function(){
                            location.reload();
                        },1000);
                    });
                }
                },
                {addClass: 'btn btn-danger btn-clean', text: '取消', onClick: function($noty) {
                    $noty.close();
                }
                }
            ]
        })
    }
</script>
{%endblock%}